package com.xiaotao.learn.algorithm.sort;

public class SleepSort {
    public static void main(String[] args) throws InterruptedException {
        int[] arr = new int[]{1,32,-12,-4,6,114};
        int min = Integer.MAX_VALUE;
        for (int i : arr) {
            if (i < min) min = i;
        }
        int finalMin = Math.abs(min);
        for (int i : arr) {
            new Thread(() -> {
                try {
                    Thread.sleep(i + finalMin);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(i);
            }).start();
        }
    }
}
